export default {
    render(h){
        // 标记当前router-view的深度
        // console.log(this)
        this.$vnode.data.routerView = true

        let depth = 0
        let parent = this.$parent
        while(parent){
            const vnodedata = parent.$vnode && parent.$vnode.data
            if(vnodedata){
                if(vnodedata.routerView){
                    // 说明当前parent是router-view
                    depth++
                 }
            }
            parent = parent.$parent
        }
        // 获取path对应的component
        // const {routeMap, current} = this.$router
        // console.log(this.$router)
        let component = null;
        const route = this.$router.matched[depth]
        if(route){
            component = route.component
        }
        // console.log(component)
        return h(component)
    }
}
 